{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Connected Scatterplot (Lines with Custom Paths)\n",
    "-----------------------------------------------\n",
    "\n",
    "This example shows how layering can be used to build a plot. This dataset tracks miles driven per capita along with gas prices annually from 1956 to 2010. It is based on the May 2, 2010 New York Times article 'Driving Shifts Into Reverse'. See http://mbostock.github.io/protovis/ex/driving.html .\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "\n",
    "driving = data.driving()\n",
    "\n",
    "lines = alt.Chart(driving).mark_line().encode(\n",
    "    alt.X('miles', scale=alt.Scale(zero=False)),\n",
    "    alt.Y('gas', scale=alt.Scale(zero=False)),\n",
    "    order='year'\n",
    ")\n",
    "\n",
    "points = alt.Chart(driving).mark_circle().encode(\n",
    "    alt.X('miles', scale=alt.Scale(zero=False)),\n",
    "    alt.Y('gas', scale=alt.Scale(zero=False))\n",
    ")\n",
    "\n",
    "lines + points\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
